package com.lovo.psc.controller;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.lovo.psc.entity.PscTriumph;
import com.lovo.psc.service.IPscTriumphService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lovo
 * @since 2022-07-11
 */
@RestController
@RequestMapping("/psc-triumph")
@Api(tags = "中标订单模块——————李鑫")
public class PscTriumphController {
    @Autowired
    IPscTriumphService service;

    @GetMapping("findIdInOrder/{supplyCode}")
    @ApiOperation(value = "按照供应商查询中标订单")
    public List<PscTriumph> findIdInOrder(@PathVariable("supplyCode") Integer supplyCode){
        List<PscTriumph> pscTriumphList = service.findIdInOrder(supplyCode);
        return pscTriumphList;
    }

    @ApiOperation(value = "修改订单状态")
    @PutMapping("updateTriumphState/{triumphCode}")
    public void updateTriumphState(@PathVariable("triumphCode") String triumphCode){
        UpdateWrapper wrapper = new UpdateWrapper<>();
        wrapper.eq("triumphNumber",triumphCode);
        PscTriumph pscTriumph = new PscTriumph();
        pscTriumph.setTriumphnumber(triumphCode);
        pscTriumph.setMarkdate("1999-09-09");
        service.update(pscTriumph,wrapper);
    }

}
